<h3><?php echo $this->title?></h3>
<div style="color:red;" id="edit_message"><?php echo $this->errMessage;?></div>
<div class="upload-image">
<form action="/admin/course/save" method="post" enctype="multipart/form-data">
    <table class="table table-bordered table-striped">
        <tbody>
             <tr>
                 <td style="width: 20%">Tên khóa</td>
                 <td>
                     Click vào đây để chỉnh đa ngôn ngữ
                     <a data-backdrop="static" data-toggle="modal" href="#edit_course_title_popup" title="Chỉnh sửa title" >
                         <i class="icon-edit"></i>
                     </a>
                 </td>
             </tr>
             <tr>
                 <td>SEO title</td>
                 <td>
                     <div>
                         <span style="margin: 10px; width: 50px; display: inline-block;font-weight: bold;">EN</span>
                         <textarea name="en_seo_title" id="en_seo_title" rows="5" style="width: 70%"><?php echo $this->course['seo_titles']['en']['content']?></textarea>
                     </div>
                     <div>
                         <span style="margin: 10px; width: 50px; display: inline-block;font-weight: bold;">VI</span>
                         <textarea name="vi_seo_title" id="vi_seo_title" rows="5" style="width: 70%"><?php echo $this->course['seo_titles']['vi']['content']?></textarea>
                     </div>
                 </td>
             </tr>
             <tr>
                 <td>SEO description</td>
                 <td>
                     <div>
                         <span style="margin: 10px; width: 50px; display: inline-block;font-weight: bold;">EN</span>
                         <textarea name="en_seo_description" id="en_seo_description" rows="5" style="width: 70%"><?php echo $this->course['seo_descriptions']['en']['content']?></textarea>
                     </div>
                     <div>
                         <span style="margin: 10px; width: 50px; display: inline-block;font-weight: bold;">VI</span>
                         <textarea name="vi_seo_description" id="vi_seo_description" rows="5" style="width: 70%"><?php echo $this->course['seo_descriptions']['vi']['content']?></textarea>
                     </div>
                 </td>
             </tr>
             <tr>
                 <td>SEO keywords</td>
                 <td>
                     <div>
                         <span style="margin: 10px; width: 50px; display: inline-block;font-weight: bold;">EN</span>
                         <textarea name="en_seo_keywords" id="en_seo_keywords" rows="5" style="width: 70%"><?php echo $this->course['seo_keywords']['en']['content']?></textarea>
                     </div>
                     <div>
                         <span style="margin: 10px; width: 50px; display: inline-block;font-weight: bold;">VI</span>
                         <textarea name="vi_seo_keywords" id="vi_seo_keywords" rows="5" style="width: 70%"><?php echo $this->course['seo_keywords']['vi']['content']?></textarea>
                     </div>
                 </td>
             </tr>
              <!-- tr>
                 <td>Ảnh đại diện
                     <?php if($this->course['image']) {?>
                         <img src="<?php echo Utils_Global::get('staticUrl') . '/course/' . $this->course['hash_folder'] . '/' . $this->course['image']?>" alt="<?php echo $this->course['image']?>" width="50" height="50">
                     <?php }?>
                 </td>
                 <td>
                     <input type="file" name="file" id="file" accept="image/*" title="Chỉ chấp nhận các định dạng hình ảnh (png, jpg, jpge, gif)">
                 </td>
             </tr-->
             <tr>
                 <td>Thứ tự</td>
                 <td>
                     <input type="number" name="order" id="order" value="<?php echo $this->course['order']?>"/>
                 </td>
             </tr>
             <tr>
                 <td>Là khóa học con của</td>
                 <td>
                     <select name="parent" id="parent">
                         <option value="0">[Chọn khóa học cha]</option>
                         <?php foreach ($this->parents as $parent): ?>
                             <option value="<?php echo $parent['id']?>" <?php echo $this->course['parent'] == $parent['id']? 'selected="selected"':""?>>
                                 <?php echo $parent['titles']['vi']['content']?>
                             </option>
                         <?php endforeach;?>
                     </select>
                 </td>
             </tr>
             <tr>
                 <td>Khai giảng (YYYY-MM-DD)</td>
                 <td>
                     <input type="date" name="start_time" id="start_time" value="<?php echo $this->course['start_time']? date('Y-m-d', $this->course['start_time']) : ''?>"/>
                 </td>
             </tr>
             <tr>
                 <td>Lịch học (2-4-6 hay 3-5-7)</td>
                 <td>
                     <input type="text" maxlength="50" value="<?php echo $this->course['schedule_type'];?>" name="schedule_type"/>
                 </td>
             </tr>
             <tr>
                 <td> Địa điểm học</td>
                 <?php $locations = json_decode($this->course['location'], true)?>
                 <td>
                     <?php foreach (Utils_Global::getLocations() as $key => $location):?>
                         <input type="checkbox" name="location[]" id="<?php echo $key?>" value="<?php echo $location?>" 
                                 <?php echo in_array($location, $locations)?'checked="checked"':''?>/>
                         <label for="<?php echo $key?>" style="display: inline-block;"><?php echo $location?></label><br/>
                     <?php endforeach;?>
                 </td>
             </tr>
             <tr>
                 <td>Hiện trên web</td>
                 <td>
                     <input type="checkbox" name="active" id="active" <?php echo $this->course['active']?'checked="checked"':"";?>/>
                 </td>
             </tr>
             <tr>
                <td colspan="2">
                    <input type="submit" value="Lưu" onclick="return HandleFunction.checkValidEditCourse()"/>
                    <a href="/admin/course/list">Hủy</a>
                </td> 
             </tr>
        </tbody>
      </table>
      <input type="hidden" id="en_title" name="en_title" value="<?php echo $this->entranslation['content']?>"/>
      <input type="hidden" id="vi_title" name="vi_title" value="<?php echo $this->vitranslation['content']?>"/>
      <input type="hidden" id="en_id" name="en_id" value="<?php echo $this->entranslation['id']?>">
      <input type="hidden" id="vi_id" name="vi_id" value="<?php echo $this->vitranslation['id']?>">
      <input type="hidden" id="en_seo_title_id" name="en_seo_title_id" value="<?php echo $this->enTranslationSeoTitle['id']?>">
      <input type="hidden" id="vi_seo_title_id" name="vi_seo_title_id" value="<?php echo $this->viTranslationSeoTitle['id']?>">
      <input type="hidden" id="en_seo_description_id" name="en_seo_description_id" value="<?php echo $this->enTranslationSeoDescription['id']?>">
      <input type="hidden" id="vi_seo_description_id" name="vi_seo_description_id" value="<?php echo $this->viTranslationSeoDescription['id']?>">
      <input type="hidden" id="en_seo_keyword_id" name="en_seo_keyword_id" value="<?php echo $this->enTranslationSeoKeyword['id']?>">
      <input type="hidden" id="vi_seo_keyword_id" name="vi_seo_keyword_id" value="<?php echo $this->viTranslationSeoKeyword['id']?>">
      <input type="hidden" value="<?php echo $this->course['id']?>" name="id" id="id"/>
      <input type="hidden" value="<?php echo $this->course['i18n_title']?>" name="i18n_id" id="i18n_id"/>
</form>
</div>
<!-- Edit popup -->
<div id="edit_course_title_popup" class="modal fade" style="display: none;"
            tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
          <div class="modal-content">
            <div class="modal-header">
              <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
              <h4 class="modal-title">Chỉnh sửa tiêu đề</h4>
            </div>
            <div class="modal-body">
                <div id="message"></div>
                <label for="edit_en_title">EN</label>
                <input type="text" id="edit_en_title" maxlength="125" style="width: 90%;"/>
                <label for="edit_vi_title">VI</label>
                <input type="text" id="edit_vi_title" maxlength="125" style="width: 90%;"/>
            </div>
            <div class="modal-footer">
              <button type="button" class="btn btn-default" data-dismiss="modal">Đóng</button>
              <button type="button" class="btn btn-primary" onclick="HandleFunction.onOkEditCourseTitle();">Lưu</button>
            </div>
          </div><!-- /.modal-content -->
        </div><!-- /.modal-dialog -->
</div>